import com.sun.org.apache.xpath.internal.axes.ReverseAxesWalker;

import javax.sound.sampled.ReverbType;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Three {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        char[] s=br.readLine().toCharArray();
        int n=s.length;
        Reverse(s,0,n-1);
        int left=0;
        while (left<n){
            int right=left;
            while (right<n&&s[right]!=' ')//找单词
                right++;
            Reverse(s,left,right-1);
            while (right<n&&s[right]==' ')
                right++;
            left=right;
        }
        for (char ch :
                s) {
            System.out.print(ch);
        }
    }

    private static void Reverse(char[] s, int left, int right) {
        int l=left,r=right;
        while (l<r){
            char ch=s[l];
            s[l]=s[r];
            s[r]=ch;
            l++;
            r--;
        }
    }
}
